package eg.com.itiga.ui.actions;



import java.util.Enumeration;
import java.util.List;
import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import eg.com.itiga.business.base.BaseService;
import eg.com.itiga.business.company.CompanyService;
import eg.com.itiga.business.factory.BusinessFactory;
import eg.com.itiga.domain.Company;
import eg.com.itiga.domain.Field;
import eg.com.itiga.ui.beans.ManageCompanyActionForm;

public class ManageCompanyAction extends org.apache.struts.action.Action {

    public ManageCompanyAction() {
    }
    
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        
        ManageCompanyActionForm frm=(ManageCompanyActionForm) form;
        
        BaseService baseService = BusinessFactory.createBaseService();
        List<Field> fields = baseService.findAll(Field.class);
        frm.setCompanyFields(fields);
        
        //initialize the rest of the form bean data
        CompanyService cmpSrv = BusinessFactory.createCompanyService();
        frm.setRegisteredCompanies(cmpSrv.getCompanyByStatus(true));
      
        return mapping.findForward("managecompany");
    }

}